package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TVideoReview;
import com.ruoyi.system.service.ITVideoReviewService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 视频审核Controller
 * 
 * @author ruoyi
 * @date 2025-09-24
 */
@RestController
@RequestMapping("/system/review")
public class TVideoReviewController extends BaseController
{
    @Autowired
    private ITVideoReviewService tVideoReviewService;

    /**
     * 查询视频审核列表
     */
    @PreAuthorize("@ss.hasPermi('system:review:list')")
    @GetMapping("/list")
    public TableDataInfo list(TVideoReview tVideoReview)
    {
        startPage();
        List<TVideoReview> list = tVideoReviewService.selectTVideoReviewList(tVideoReview);
        return getDataTable(list);
    }

    /**
     * 导出视频审核列表
     */
    @PreAuthorize("@ss.hasPermi('system:review:export')")
    @Log(title = "视频审核", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TVideoReview tVideoReview)
    {
        List<TVideoReview> list = tVideoReviewService.selectTVideoReviewList(tVideoReview);
        ExcelUtil<TVideoReview> util = new ExcelUtil<TVideoReview>(TVideoReview.class);
        util.exportExcel(response, list, "视频审核数据");
    }

    /**
     * 获取视频审核详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:review:query')")
    @GetMapping(value = "/{reviewId}")
    public AjaxResult getInfo(@PathVariable("reviewId") Long reviewId)
    {
        return success(tVideoReviewService.selectTVideoReviewByReviewId(reviewId));
    }

    /**
     * 新增视频审核
     */
    @PreAuthorize("@ss.hasPermi('system:review:add')")
    @Log(title = "视频审核", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TVideoReview tVideoReview)
    {
        return toAjax(tVideoReviewService.insertTVideoReview(tVideoReview));
    }

    /**
     * 修改视频审核
     */
    @PreAuthorize("@ss.hasPermi('system:review:edit')")
    @Log(title = "视频审核", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TVideoReview tVideoReview)
    {
        return toAjax(tVideoReviewService.updateTVideoReview(tVideoReview));
    }

    /**
     * 删除视频审核
     */
    @PreAuthorize("@ss.hasPermi('system:review:remove')")
    @Log(title = "视频审核", businessType = BusinessType.DELETE)
	@DeleteMapping("/{reviewIds}")
    public AjaxResult remove(@PathVariable Long[] reviewIds)
    {
        return toAjax(tVideoReviewService.deleteTVideoReviewByReviewIds(reviewIds));
    }
}
